import pygame,sys

from pygame.locals import *

def main(args):
    pygame.init()

    windowSurface = pygame.display.set_mode((500,400),0,32)
    windowRect=windowSurface.get_rect()

    pygame.display.set_caption('Hello World')

    BLACK = (0,0,0)
    WHITE = (255,255,255)
    RED = (255,0,0)
    GREEN = (0,255,0)
    BLUE = (0,0,255)

    basicFont=pygame.font.SysFont(None,48)

    text=basicFont.render('Hello World!',True,WHITE,BLUE)
    textRect=text.get_rect()
    textRect.centerx=windowRect.centerx
    textRect.centery=windowRect.centery

    windowSurface.fill(WHITE)

    windowSurface.blit(text,textRect)

    pygame.display.update()

    return main_loop()

def main_loop():

    while True:
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()

    return 0

def target(*args,**kwargs):
    return main,None

